/*
 * 作者:LHW-HWT
 * 发现BUG或者想完善游戏可以发送邮件到1281702594@qq.com
 * 本作品使用CC协议
您可以自由地：
共享 — 在任何媒介以任何形式复制、发行本作品
演绎 — 修改、转换或以本作品为基础进行创作
只要你遵守许可协议条款，许可人就无法收回你的这些权利。
署名 — 您必须给出适当的署名，提供指向本许可协议的链接，同时标明是否（对原始作品）作了修改。您可以用任何合理的方式来署名，但是不得以任何方式暗示许可人为您或您的使用背书。
非商业性使用 — 您不得将本作品用于商业目的。包括直接拿去参加比赛
相同方式共享 — 如果您再混合、转换或者基于本作品进行创作，您必须基于与原先许可协议相同的许可协议 分发您贡献的作品。
没有附加限制 — 您不得适用法律术语或者 技术措施 从而限制其他人做许可协议允许的事情。
 */
#include <Arduboy2.h>
Arduboy2 arduboy;
/*=========================================================
                         位图
  =========================================================*/
/*
  const uint8_t HWT[] PROGMEM = {};
*/
//HWT 作者信息 请勿删除
const uint8_t HWT[] PROGMEM = {0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x06, 0x33, 0x3c, 0x12, 0x8b, 0xe0, 0x89, 0x44, 0x42, 0x09, 0x49, 0x24, 0x12, 0x88, 0x80, 0x89, 0x44, 0x99, 0x02, 0x49, 0x3c, 0x1e, 0x88, 0x8c, 0x8f, 0x44, 0x99, 0x04, 0x49, 0x24, 0x12, 0xa8, 0x8c, 0x89, 0x54, 0x42, 0x08, 0x49, 0x24, 0x12, 0x50, 0x80, 0x89, 0x28, 0x66, 0x0f, 0x33, 0xbc, 0x12, 0x50, 0x80, 0xe9, 0x28, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t CSV[] PROGMEM = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0x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b7,0xef,0xe7,0x7e,0xfe,0xff,0xff,0x30,0x70,0x00,0x7d,0x5c,0x80,0x01,0xef,0x73,0xb0,0x0f,0x9f,0x8e,0x00,0xff,0xf8,0xfe,0xf7,0xff,0x7e,0xbd,0xff,0xff,0xde,0xfb,0xb7,0xec,0x7f,0xde,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
const uint8_t BG[] PROGMEM = {0x99, 0x99, 0x99, 0x99, 0x99, 0x98, 0x06, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x55, 0x49, 0x25, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x92, 0x49, 0x24, 0x92, 0x49, 0x20, 0x00, 0x49, 0x25, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49, 0x2d, 0xc0, 0x49, 0x25, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49, 0x24, 0x6d, 0xb6, 0xdb, 0x6d, 0xb6, 0xcd, 0xc1, 0xb6, 0xda, 0xdb, 0x6d, 0xb6, 0xdb, 0x6d, 0xb6, 0xdb, 0x92, 0x49, 0x24, 0x92, 0x49, 0x2d, 0x60, 0x49, 0x25, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49, 0x23, 0x60, 0x49, 0x25, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49, 0x24, 0x3f, 0xe7, 0xfc, 0xff, 0x9f, 0xef, 0xf1, 0xfe, 0x7f, 0xdf, 0xf3, 0xfe, 0x7f, 0xcf, 0xf9, 0xff, 0xdf, 0xdb, 0xfb, 0x7f, 0x6f, 0xef, 0x39, 0xfd, 0xbf, 0xaf, 0xed, 0xfd, 0xbf, 0xb7, 0xf6, 0xfe, 0xc7, 0x18, 0xe3, 0x1c, 0x63, 0x8f, 0xd8, 0x71, 0x8e, 0x23, 0x8c, 0x71, 0x8e, 0x31, 0xc6, 0x38, 0xd0, 0xda, 0x1b, 0x43, 0x68, 0x6f, 0x19, 0x0d, 0xa1, 0xa8, 0x6d, 0x0d, 0xa1, 0xb4, 0x36, 0x86, 0xd5, 0x5a, 0xab, 0x55, 0x6a, 0xae, 0x51, 0x55, 0xaa, 0xaa, 0xad, 0x55, 0xaa, 0xb5, 0x56, 0xaa, 0xca, 0x99, 0x13, 0x2a, 0x64, 0x4e, 0x20, 0xa9, 0x91, 0x25, 0x4c, 0x89, 0x95, 0x32, 0x26, 0x54};
const uint8_t Man1[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0xc0, 0x00, 0x00, 0x00, 0x77, 0xff, 0x00, 0x00, 0x00, 0x77, 0xfe, 0x00, 0x00, 0x00, 0x0f, 0xe1, 0x00, 0x00, 0x00, 0x1f, 0x8a, 0x00, 0x00, 0x00, 0x1f, 0x0a, 0x00, 0x00, 0x00, 0x1f, 0x0a, 0x00, 0x00, 0x00, 0x0e, 0x43, 0x00, 0x00, 0x00, 0x12, 0xe3, 0x00, 0x00, 0x00, 0x08, 0x4a, 0x00, 0x00, 0x00, 0x06, 0x04, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x07, 0xf2, 0x00, 0x00, 0x00, 0x07, 0xfd, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x80, 0x00, 0x00, 0x04, 0x3c, 0x80, 0x00, 0x00, 0x02, 0x13, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x3f, 0xf0, 0x00, 0x00, 0x00, 0xc0, 0x3b, 0xf8, 0x00, 0x01, 0x00, 0x07, 0xfc, 0x00, 0x02, 0x00, 0x07, 0xfe, 0x00, 0x04, 0x00, 0x0f, 0xe1, 0x00, 0x08, 0x00, 0x0f, 0xc6, 0x80, 0x0b, 0x00, 0x3f, 0x82, 0x80, 0x12, 0x00, 0x0f, 0x80, 0x80, 0x16, 0x00, 0x1f, 0x80, 0x40, 0x17, 0x00, 0x0f, 0xe0, 0x40, 0x66, 0x10, 0x4f, 0xfc, 0x80, 0xac, 0x38, 0xcf, 0xdf, 0x00, 0xac, 0x4f, 0x9f, 0x30, 0x00, 0xb8, 0xc8, 0x06, 0x20, 0x00, 0x44, 0x66, 0x22, 0x30, 0x00, 0x02, 0x51, 0x13, 0x08, 0x00, 0x02, 0x2d, 0x11, 0x88, 0x00, 0x01, 0xc2, 0x0e, 0x70, 0x00};
const uint8_t Man2[] PROGMEM = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0xf1, 0x00, 0x00, 0x00, 0x3b, 0xff, 0x80, 0x00, 0x00, 0x3b, 0xff, 0x00, 0x00, 0x00, 0x07, 0xf0, 0x80, 0x00, 0x00, 0x0f, 0xc5, 0x00, 0x00, 0x00, 0x0f, 0x85, 0x00, 0x00, 0x00, 0x0f, 0x85, 0x00, 0x00, 0x00, 0x07, 0xa1, 0x80, 0x00, 0x00, 0x09, 0x71, 0x80, 0x00, 0x00, 0x04, 0x25, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x00, 0x03, 0xfb, 0x00, 0x00, 0x00, 0x03, 0xfc, 0x80, 0x00, 0x00, 0x01, 0xfc, 0x80, 0x00, 0x00, 0x01, 0x3d, 0x00, 0x00, 0x00, 0x02, 0x06, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x04, 0x60, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x1c, 0x05, 0xf0, 0x00, 0x00, 0x60, 0x03, 0xfc, 0x00, 0x00, 0x80, 0x1f, 0xfe, 0x00, 0x01, 0x00, 0x0f, 0xff, 0x00, 0x02, 0x00, 0x3f, 0xe7, 0x00, 0x0c, 0x00, 0x5f, 0x8d, 0x00, 0x10, 0x00, 0x3f, 0x84, 0x00, 0x67, 0x00, 0x7f, 0xc0, 0x80, 0x8a, 0x00, 0x9f, 0xe1, 0x00, 0x6c, 0x00, 0x1f, 0xb8, 0x80, 0x50, 0x7f, 0x87, 0x8f, 0x00, 0x20, 0x97, 0xfa, 0x06, 0x00, 0x23, 0x60, 0x01, 0xc3, 0x80, 0x44, 0xc0, 0x00, 0x39, 0x00, 0x89, 0x00, 0x00, 0x0e, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00};
const uint8_t Man3[] PROGMEM = {0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x20, 0x80, 0x80, 0x00, 0x00, 0x38, 0x98, 0x00, 0x00, 0x00, 0x08, 0x18, 0x00, 0x00, 0x00, 0x04, 0x3c, 0x00, 0x00, 0x00, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x10, 0xfc, 0x00, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x3b, 0xfe, 0x00, 0x00, 0x00, 0x1f, 0xff, 0x00, 0x00, 0x00, 0x2e, 0x1f, 0x00, 0x00, 0x00, 0x08, 0x03, 0x80, 0x00, 0x00, 0x09, 0x22, 0x00, 0x00, 0x00, 0x11, 0x21, 0x00, 0x00, 0x00, 0x5c, 0xce, 0x00, 0x00, 0x00, 0xac, 0xcc, 0x80, 0x00, 0x00, 0xb8, 0x07, 0x40, 0x00, 0x00, 0x9a, 0x16, 0x40, 0x00, 0x00, 0x7d, 0xef, 0x80, 0x00, 0x00, 0x35, 0xeb, 0x00, 0x00, 0x00, 0x2a, 0x15, 0x00, 0x00, 0x00, 0x70, 0x03, 0x80, 0x00, 0x00, 0x40, 0x01, 0x80, 0x00, 0x00, 0x4f, 0xe9, 0x00, 0x00, 0x00, 0x70, 0x17, 0xf4, 0x00, 0x00, 0x40, 0x1f, 0xff, 0x00, 0x40, 0x80, 0x0f, 0xff, 0x80, 0x60, 0x81, 0x3f, 0xbb, 0x00, 0x57, 0x00, 0xff, 0x80, 0x80, 0x48, 0x00, 0x3f, 0x31, 0x00, 0x20, 0x00, 0x7f, 0x4b, 0x00, 0x13, 0x00, 0x7f, 0x49, 0x80, 0x0e, 0x00, 0x3f, 0x31, 0x40, 0x0c, 0x00, 0x7f, 0xe0, 0xc0, 0x10, 0x3f, 0x87, 0xb8, 0x40, 0x20, 0x97, 0xd5, 0x0e, 0x80, 0x23, 0x60, 0x29, 0xf1, 0x00, 0x44, 0xc0, 0x10, 0x8d, 0x00, 0x89, 0x80, 0x00, 0x06, 0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00};
const uint8_t Fire1[] PROGMEM = {0x00, 0x14, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x56, 0x00, 0x01, 0xa5, 0x80, 0x01, 0xc2, 0x80, 0x01, 0x43, 0x40, 0x01, 0x80, 0xc0, 0x02, 0x81, 0x40, 0x03, 0x81, 0xa0, 0x16, 0x00, 0x60, 0x0d, 0x00, 0xcc, 0x03, 0x00, 0xa4, 0x05, 0x00, 0xd0, 0x06, 0x00, 0x30, 0x0c, 0x00, 0x50, 0x0a, 0x00, 0x60, 0x06, 0x00, 0x50, 0x0a, 0x00, 0x30, 0x0a, 0x00, 0x50, 0x0d, 0x00, 0x60, 0x0a, 0x80, 0x50, 0x06, 0x00, 0x34, 0x3e, 0x00, 0x50, 0x0a, 0x00, 0x68, 0x0c, 0x00, 0x50, 0x0a, 0x00, 0x30, 0x06, 0x00, 0x50, 0x0a, 0x00, 0x60, 0x05, 0x00, 0x50, 0x06, 0x00, 0xa0, 0x05, 0x00, 0xc0, 0x03, 0x40, 0xa0, 0x05, 0x80, 0x60, 0x06, 0x81, 0xb0, 0x03, 0x01, 0x48, 0x22, 0x80, 0xc0, 0x00, 0xc3, 0xc0, 0x01, 0x02, 0x00, 0x01, 0xe7, 0x80, 0x00, 0x55, 0x00, 0x01, 0x6a, 0x00, 0x00, 0x2c, 0x00};
const uint8_t Fire2[] PROGMEM = {0x00, 0x14, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x56, 0x00, 0x01, 0xa5, 0x80, 0x01, 0xc2, 0x80, 0x01, 0x43, 0x40, 0x01, 0x80, 0xc0, 0x02, 0x81, 0x40, 0x03, 0x81, 0xa0, 0x06, 0x00, 0x60, 0x05, 0x00, 0xc0, 0x03, 0x00, 0xa0, 0x05, 0x00, 0xc0, 0x06, 0x00, 0x30, 0x0c, 0x00, 0x50, 0x0a, 0x00, 0x60, 0x06, 0x00, 0x50, 0x0a, 0x00, 0x30, 0x0a, 0x00, 0x50, 0x0c, 0x00, 0x60, 0x0a, 0x00, 0x50, 0x06, 0x00, 0x30, 0x0e, 0x00, 0x50, 0x0a, 0x00, 0x60, 0x0c, 0x00, 0x50, 0x0a, 0x00, 0x30, 0x06, 0x00, 0x50, 0x0a, 0x00, 0x60, 0x05, 0x00, 0x50, 0x06, 0x00, 0xa0, 0x05, 0x00, 0xc0, 0x03, 0x00, 0xa0, 0x05, 0x00, 0x60, 0x02, 0x81, 0xa0, 0x03, 0x01, 0x40, 0x02, 0x80, 0xc0, 0x00, 0xc3, 0xc0, 0x01, 0x02, 0x00, 0x01, 0xe7, 0x80, 0x00, 0x55, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x2c, 0x00};
/*=========================================================
  变量
  =========================================================*/
#define ManChangeTime 250 //设置全局动画每帧时间 单位ms
unsigned long MCT; //记录小人改变帧的时间
unsigned long FCT; //记录火圈改变帧的时间
byte FS; //火圈对应状态
byte MS; //小人状态 对应Man1 Man2 Man3
byte KeyBack; //按键扫描返回
int xy[4] = {20, 24, -128, 0}; //1-2 小人位置 3-4 背景位置
float MYG;//小人Y方向加速度
byte ManCollision[8] = {11, 1, 14, 21, 0, 23, 34, 17}; //小人碰撞箱子 格式 在精灵中的x和y位置 以及长度和高度 一个碰撞箱4个数据
byte FireCollision[4] = {6, 38, 10, 3}; //火圈碰撞箱
int Firexy[20] = {160, 6, 240, 12, 356, 19, 424, 12, 480, 10, 542, 18, 608, 18, 704, 10, 798, 8, 866, 19}; //一共10个火圈
int GX; //游戏进度
/*====================================================================
                             软重启函数
  ====================================================================*/
void(* resetFunc) (void) = 0; //制造重启命令
/*=========================================================
  按键扫描
  =========================================================*/
void key() {
  /*
      0  1  2  3  4  5
      ↑ ↓← →  A  B
  */
  KeyBack = 255;
  if (arduboy.pressed(UP_BUTTON)) KeyBack = 0;
  if (arduboy.pressed(DOWN_BUTTON)) KeyBack = 1;
  if (arduboy.pressed(LEFT_BUTTON)) KeyBack = 2;
  if (arduboy.pressed(RIGHT_BUTTON)) KeyBack = 3;
  if (arduboy.pressed(A_BUTTON)) KeyBack = 4;
  if (arduboy.pressed(B_BUTTON)) KeyBack = 5;
}
/*=========================================================
  绘图
  =========================================================*/
void draw() {
  arduboy.clear();   //清屏
  /*
     显示背景
  */
  for (byte i = 0; i < 3; i++) {
    arduboy.drawSlowXYBitmap(xy[2] + i * 128, xy[3], BG, 128, 14, 1); //显示背景
  }
  arduboy.fillRect(0, 15, 128, 49, 1); //在(0,15)的地方画一个颜色为白色的长方形 大小为128x49
  for (byte i = 1; i <= 6; i++) {
    arduboy.drawLine(0, i * i + 15, 128, i * i + 15, 0); //画背景黑线
  }
  //显示火圈
  for (byte i = 0; i < (sizeof(Firexy) / sizeof(Firexy[0])) / 2; i++) {
    if (Firexy[i * 2] - GX >= -8 && Firexy[i * 2] - GX < 128) {
      switch (FS) {
        case 0:
          arduboy.drawSlowXYBitmap(Firexy[i * 2] - GX, Firexy[i * 2 + 1] , Fire1, 22, 42, 0);
          break;
        case 1:
          arduboy.drawSlowXYBitmap(Firexy[i * 2] - GX, Firexy[i * 2 + 1] , Fire2, 22, 42, 0);
          break;
      }
      for (byte a = 0; a < (sizeof(ManCollision) / sizeof(ManCollision[0])) / 4; a++) {  //计算碰撞箱
        if (xy[0] + ManCollision[a * 4] + ManCollision[a * 4 + 2]  > Firexy[i * 2] - GX + FireCollision[0] &&
            Firexy[i * 2] - GX + FireCollision[0] + FireCollision[2]  > xy[0] + ManCollision[a * 4] &&
            xy[1] + ManCollision[a * 4 + 1] + ManCollision[a * 4 + 3] > Firexy[i * 2 + 1] + FireCollision[1] &&
            Firexy[i * 2 + 1] + FireCollision[1] + FireCollision[3] > xy[1] + ManCollision[a * 4 + 1]) {
          if (MS != 2) {
            MS = 2; //状态为死亡  把这一行删掉即可开启无敌模式
            MYG = -5; //跳跃
          }
        }
        /*
          if (rc1.x + rc1.width  > rc2.x &&
          rc2.x + rc2.width  > rc1.x &&
          rc1.y + rc1.height > rc2.y &&
          rc2.y + rc2.height > rc1.y
          )

           rc1.x      xy[0] + ManCollision[a * 4]
           rc1.width  ManCollision[a * 4 + 2]
           rc1.y      xy[1] + ManCollision[a * 4 + 1]
           rc1.high   ManCollision[a * 4 + 3]

           rc2.x      Firexy[i * 2] - GX+FireCollision[0]
           rc2.width FireCollision[2]
           rc2.y      Firexy[i * 2 + 1]+FireCollision[1]
           rc2.high   FireCollision[3]
        */
      }
    }
  }

  /*
     显示小人
  */
  for (byte i = 0; i < (sizeof(ManCollision) / sizeof(ManCollision[0])) / 4; i++) {
    arduboy.fillRect(xy[0] + ManCollision[i * 4], xy[1] + ManCollision[i * 4 + 1], ManCollision[i * 4 + 2], ManCollision[i * 4 + 3], 1); //清除多余的黑线
  }
  switch (MS) {
    case 0:
      arduboy.drawSlowXYBitmap(xy[0], xy[1], Man1, 34, 40, 0); //显示小人
      break;
    case 1:
      arduboy.drawSlowXYBitmap(xy[0], xy[1], Man2, 34, 40, 0); //显示小人
      break;
    case 2:
      arduboy.drawSlowXYBitmap(xy[0], xy[1], Man3, 34, 40, 0); //显示小人
      break;
  }
  /*
     显示剩余步数
  */
  arduboy.setCursor(0, 0);
  arduboy.print(1000 - GX);
  arduboy.display(); //显示到屏幕上
}
/*=========================================================
  DEBUG
  =========================================================*/
void DEBUG() {

}
/*=========================================================
  逻辑
  =========================================================*/
void logic() {
  /*
     移动
  */
  if (MS != 2) {
    switch (KeyBack) {
      case 2:
        xy[2] += 3;
        GX -= 3;
        break;
      case 3:
        xy[2] -= 3;
        GX += 3;
        break;
      case 4:
        if (xy[1] == 24) MYG = -5;
        break;
    }

    /*
        移动火圈
    */
    for (byte i = 0; i < (sizeof(Firexy) / sizeof(Firexy[0])) / 2; i++) {
      if (Firexy[i * 2] < GX) Firexy[i * 2] = 896 + GX; //无限循环
      Firexy[i * 2] -= 2;
    }
    /*
       小人移动动画
    */
    if (millis() >= MCT + ManChangeTime && KeyBack != 255) {
      MCT = millis();
      if (MS == 0) {
        MS = 1;
      } else if (MS == 1) MS = 0;
    } else MS = 0;
  }
  /*
       跳跃加速度计算
  */
  MYG += 0.5;
  xy[1] += MYG;
  if (xy[1] >= 24 && MS != 2) { //落地归零
    xy[1] = 24; //重置y坐标
    MYG = 0; //重置加速度
  }
  /*
     动态火焰
  */
  if (millis() >= FCT + ManChangeTime) {
    FCT = millis();
    if (FS == 0) {
      FS = 1;
    } else FS = 0;
  }
  /*
     防止背景溢出
  */
  if (xy[2] < -128) {
    xy[2] += 128;
  } else if (xy[2] > 0) xy[2] -= 128;

}
/*=========================================================
                  胜利
  =========================================================*/
void win() {
  for (byte y = 0; y < 8; y++) {
    for (byte x = 0; x < 7; x += 3) {
      arduboy.setCursor(x * 6, y * 8);           //设置光标
      arduboy.print(F("WIN"));                 //打印 你赢了
      arduboy.display();                        //把画面显示在OLED上
    }
  }
  while (1) {}
}
/*=========================================================
                  失败
  =========================================================*/
void fail() {
  while (xy[1] < 128) {
    logic();
    draw();
  }
  resetFunc();//重置游戏
}
/*=========================================================
  只循环一次
  =========================================================*/
void setup() {
  arduboy.boot(); //启动
  for (int i = 63; i >= -8; i--) {
    arduboy.clear();
    arduboy.drawSlowXYBitmap(26, i, HWT, 72, 8, 1);
    arduboy.drawSlowXYBitmap(0, i + 8, CSV, 128, 64, 1);
    arduboy.display();
  }
  delay(1000);
}
/*=========================================================
                     不停循环
  =========================================================*/
void loop() {
  key(); //按键扫描
  logic(); //逻辑
  draw(); //绘图
  if (MS == 2) fail();
  if (GX >= 1000) win();
}
